import unittest
from page_object.login_page import LoginPage
from page_object.phone_page import PhonePage
from ddt import ddt,data,unpack
from time import sleep

@ddt
class CaseDemo(unittest.TestCase):

   # @classmethod
   # def setUpClass(cls) -> None:
    #    cls.driver = webdriver.Chrome()
    #   cls.lp = LoginPage(cls.driver)
    #    cls.pg = PhonePage(cls.driver)

    # @classmethod
    # def tearDownClass(cls) -> None:
    #    cls.driver.quit()

    # 用例运行前置
    def setUp(self) ->None:
        self.driver = webdriver.Chrome()
    # 用例运行后置
    def teatDown(self) -> None:
        sleep(5)
        self.driver = quit()
    # 用例实现登录并添加购物车流程



   #def test_1(self,u,p):
       # CaseDemo.lp.login('666666','111111')
       # CaseDemo.pg.add()
        #  driver = webdriver.Chrome()
        #  lp = LoginPage(self.driver)
        # pg = PhonePage(self.driver)
        #  lg.login(u,p)
   #  pg.add()



        @data(['666666', '111111'])
        @unpack

        # 用例实现登录操作
        def test_2(self,U,p):
        # CaseDemo.lp.login('666666','111111')
                lp = LoginPage(self.driver)
                lp.login(U,p)
                driver = webdriver.Chrome()


        if __name__ == '__main__':
             unittest.main()